package com.owen.mybatis.mapper;

import com.owen.mybatis.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface UserMapper {

    @Select("select * from user")
    List<User> list();

    @Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "id")
    @Insert(value = "insert into user(name) values (#{user.name} )")
    Long insert(@Param("user") User user);

}
